package service.Impl;

import dao.DeptDao;
import dao.Impl.DeptDaoImpl;
import pojo.Dept;
import service.DeptService;

import java.util.List;

public class DeptServiceImpl implements DeptService {
    //先生成一个Dao对象
    // 再通过Dao对象调用方法
    DeptDao deptdao=new DeptDaoImpl();
    @Override
    public int addDept(String dname) {
        return deptdao.addDept(dname);
    }

    @Override
    public int deleteDeptById(int id) {
        return deptdao.deleteDeptById(id);
    }

    @Override
    public int updateDept(Dept dept) {
        return deptdao.updateDept(dept);
    }

    @Override
    public List<Dept> findAll(Dept dept) {

        List<Dept> depts=deptdao.findAll(dept);
        return depts;
    }

    @Override
    public Dept findById(int id) {
        return deptdao.findById(id);
    }
}
